$MAX = 999;

$m = $ARGV[0];
$n = $ARGV[1];
$filename = $ARGV[2];

open FILE, ">$filename";

for ($i = 0; $i < $m; ++$i) {
	for ($j = 0; $j < $n; ++$j) {
		$val = rand($MAX);
		$val -= $MAX / 2;
		$val = int($val);
		print FILE "$val ";
	}
	print FILE "\n";
}

close FILE;
